package com.an.collection;

import java.sql.SQLOutput;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

@SuppressWarnings({"all"})
public class HomeWork_3 {
    public static void main(String[] args) {
        List list = new ArrayList();
        list.add(new Book_2("西游记","吴承恩",88.9));
        list.add(new Book_2("三国演义","罗贯中",78.9));
        list.add(new Book_2("红楼梦","曹雪芹",108.9));
        list.add(new Book_2("水浒传","施耐庵",58.8));
        Iterator iterator=list.iterator();
        for(Object o:list){
            System.out.println(o);
        }
        


    }
}

class Book_2{
    private String name;
    private String author;
    private double preice;

    public Book_2(String name, String author, double preice) {
        this.name = name;
        this.author = author;
        this.preice = preice;
    }

    @Override
    public String toString() {
        return "名称:"+name+"\t作者:"+author+"\t价格:"+preice;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public double getPreice() {
        return preice;
    }

    public void setPreice(double preice) {
        this.preice = preice;
    }
}